-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Launchpad.- Update mayberedirect launchpad option retrieval #74365
Launchpad.- Update mayberedirect launchpad option retrieval #74365
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~81 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
client/data/sites/use-launchpad.ts
Outdated
} ); | ||
}; | ||
|
||
export const useLaunchpad = ( siteSlug: string, cache = true ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been a while since I used React Query, and I know it has a range of different options and settings around caching. Do we need to worry about caching this value, and not updating quickly after the setting has been updated on the backend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth noting I tested this - by completing Launchpad, which turns the launchpad_screen option to off, and then immediately navigating to My Home. Seems to work fine. If I recall, RQ may automatticaly refetch data on window refreshes. Not sure how that interacts with the meta -> persist property here, but in any case, seems to be working just fine - no stale data when arriving on My Home.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the React Query docs, it seems like the query will refetch when its mounted again or the user refocuses on the window by default: https://react-query-v3.tanstack.com/guides/caching
For now we may be fine with the react query default values
const shouldRedirectToLaunchpad = | ||
refetchedOptions?.launchpad_screen === 'full' && | ||
launchpad_screen === 'full' && | ||
// Temporary hack/band-aid to resolve a stale issue with atomic that the requestSite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we need the 'temporary band-aid for atomic' part of this given the new endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the shouldRedirectToLaunchpad
logic since const { launchpad_screen, site_intent } = await fetchLaunchpad( slug );
should always retrieve the latest data.
This is testing as expected for me. Added a few comments. I'll also hold on approving as it's still in draft, and there's a convo happening about React Query vs using Redux data stores. Also some failing e2e tests. It's nice to be able to delete all that extra code to handle stale state situations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest code changes look good. I tested this multiple times on Simple sites with different flows. I then tested multiple times on Atomic via different flows and upgrade paths. I also tested both prelaunch (when the home-to-launchpad redirect should work) and post-launch (when the redirect should not be active). In all cases, the My Home redirect worked when it should, and did not fire when it shouldn't.
Only small issue I had was unrelated to the PR. On two separate atomic sites, I'm noticing if you upgrade to an Ecommerce plan, we always seem to load the wp-admin version of My Home, not the calypso version. In such cases, obviously the redirect doesn't work. I would force the issue by manually loading the calypso home url, and the redirect would then work.
I usually test atomic via business plans (and force the atomic transfer by activating a plugin).
I can't recall testing an ecommerce plan. I only did so here because I wanted to force the atomic transfer right away without extra steps. But because I haven't tested this before, it could be that loading the wp-admin version of the dashboard is standard behavior for ecommerce plan sites. But to the extent that's expected, our redirect in the my home controller won't fire on such sites.
This is nothing we need to address in this PR. If we did somehow want to address it, I think we would need to discuss this and do it via a very different PR.
Some e2e tests had been failing. I just re-ran them, and looks like they're good now. |
Testing✔️ Navigate to /home/{siteSlug} and verify that you are redirected to the launchpad screen |
Related to #73830
Time Estimate
Review: Short
Test: Short
Proposed Changes
/home
Testing Instructions
/home/{siteSlug}
and verify that you are redirected to the launchpad screen/home/{siteSlug}?launchpadComplete=true
and verify you are not redirected to the launchpad screenlaunchpad_screen
tooff
or FALSE) or use a site that is not launchpad enable and navigate to/home
. Verify that you are not navigated to the launchpad screen.Pre-merge Checklist